package com.example.bootmq.controller;

import com.example.bootmq.RabbitMQConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * .
 *
 * @author Xu Yayuan
 * @date 2022-09-04
 */
@RestController
public class MqDeadController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RequestMapping("/check")
    @GetMapping
    public Object checkDeadQueue(){
        rabbitTemplate.convertAndSend(RabbitMQConfig.NEW_MERCHANT_EXCHANGE, RabbitMQConfig.NEW_MERCHANT_ROUTIING_KEY, "商家审核通过");
        Map<String, Object> map = new HashMap(3);
        map.put("code", 0);
        map.put("msg","商家审核通过，请10s内上穿一个商品");
        return map;
    }
}
